package video.background.Controller;

import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import video.background.Utils.MultipartFileUtils;
import video.background.Utils.Result;

import java.io.IOException;

/**
 * @program: video-backgroud
 * @description:
 * @author: hlt
 * @create: 2023-08-14 14:31
 **/
@RestController
@RequestMapping("/api/file")
@CrossOrigin(origins = "*", maxAge = 3600)
@Api(tags = "后端文件测试，前端不用管这个接口")
public class testController {

    private static String AUDIO_PATH = "src/main/resources/static/TempAudioFiles";

    @PostMapping("/testUploadFile")
    public Result testUploadFile(@RequestParam("file") MultipartFile file) throws IOException {
        String path = MultipartFileUtils.saveMultipartFile(file, AUDIO_PATH,"23");
        System.out.println(path);
        return Result.Success("保存成功！",null);
    }

}
